add<{extend name="public/base"}>
<{block name="foot_source"}>
<script type="text/javascript" src="/static/webuploader/webuploader.js"></script>
<link rel="stylesheet" type="text/css" href="/static/webuploader/webuploader.css">
<{/block}>
<{block name="content"}>
<!-- left column -->
<div class="col-md-12">
    <!-- general form elements -->
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">内容添加页面</h3>
        </div>
        <!-- /.box-header -->
        <!-- form start -->
        <form role="form" action="<{:url('admin/exhibition/handle')}>" method="post">
            <div class="box-body">
                <div class="form-group">
                    <label for="title">活动标题</label>
                    <input type="text" class="form-control" id="title" name="title" placeholder="请输入活动标题">
                </div>
                <div class="form-group">
                    <label for="desc">活动简介</label>
                    <input type="text" class="form-control" id="desc" name="desc" placeholder="请输入描述">
                </div>
                <div class="form-group">
                    <label for="desc">活动时间</label>
                    <input type="date" class="form-control" id="exhibition_time" name="exhibition_time" placeholder="请输入时间">
                </div>
                <div>
                    <label>封面图</label>
                    <div id="cover-container"></div>
                </div>
                <div id="uploader" class="wu-example">
                    <!--用来存放文件信息-->
                    <div id="thelist" class="uploader-list"></div>
                    <div class="btns">
                        <input type="hidden" class="form-control" value="" id="cover" name="cover" />
                        <img src="" id="cover_show" />
                        <div id="picker">选择文件</div>
                    </div>
                </div>
                <div class="form-group">
                    <label>活动内容介绍</label>
                    <script id="container" name="content" type="text/plain">初始化</script>
                </div>


            </div>
            <!-- /.box-body -->

            <div class="box-footer">
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </form>
    </div>
    <!-- /.box -->
</div>


<{/block}>
<{block name="foot_script"}>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    var BASE_URL = '/static/webuploader';
    var uploader = WebUploader.create({
        // swf文件路径
        swf: BASE_URL + '/js/Uploader.swf',
        // 文件接收服务端。
        server: '/admin/api/upload',
        // 选择文件的按钮。可选。
        // 内部根据当前运行是创建，可能是input元素，也可能是flash.
        pick: '#picker',
        // 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
        resize: false
    });

    // 当有文件被添加进队列的时候
    uploader.on( 'fileQueued', function( file ) {
        uploader.upload();
    });

    // 文件上传成功，给item添加成功class, 用样式标记上传成功。
    uploader.on( 'uploadSuccess', function( file,data ) {
        console.log( data._raw );
        console.log(data.ext);
        console.log(data.filename);
        console.log(data.name);
        $("#cover").val(data.url);
        $("#cover_show").attr('src',data.url);
    });


    var ue = UE.getEditor('container');

</script>
<{/block}>

